<?php
$name_formation = "";
switch ($players['type_formation']) {
	case 1:
			$name_formation = '3-3-4';
		break;
	case 2:
			$name_formation = '3-5-2';
		break;
	case 3:
			$name_formation = '4-3-3';
		break;
	case 4:
			$name_formation = '4-4-2';
		break;
}
?>

<div>
	<fieldset>
		<label><?php echo (TEXT_CREATE_PLAYER)." - ".$name_formation; ?></label>
		<form action="<?php echo current_url() ?>" method="post">
			<button type="submit">Enviar</button>
			<table>
				<thead>
					<tr>
						<th>Nome</th>
						<th>Idade</th>
						<th>Posição</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
					<?php 
						if(!empty($players['players']) && is_array($players['players'])) {
							foreach($players['players'] as $player){
								$deft = ($player['player_deft'] == 0)?TEXT_DEFT_LEFT_HANDED:TEXT_DEFT_RIGHT_HANDED;
								echo '<tr>
										<td><input type="text" name="player_name[]" value="'.$player['player_name'].'"></td>
										<td>'.$player['player_age'].'</td>
										<td>'.$player['position_name'].'</td>
										<td>'.$deft.'</td>
									</tr>';
							}
						}
					?>
				</tbody>
			</table>
		</form>
	</fieldset>
</div>